#ifndef _COMM_THREAD_POOL_H_
#define _COMM_THREAD_POOL_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef struct thread_pool thread_pool;

typedef void (*thread_pool_work_func)(void * request, void * ctx);

thread_pool * thread_pool_create(int max, void * ctx);

int thread_pool_do(thread_pool * pool,
                   thread_pool_work_func func,
                   void * request);

void thread_pool_destory(thread_pool * pool);

void thread_pool_safe_exit();

#ifdef __cplusplus
}
#endif

#endif
